package zack.project.domain.activity.service.quota.rule.factory;

import zack.project.domain.activity.service.quota.rule.IActionChain;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * @author A1793
 * 工厂类，负责装配责任链和开启责任链
 */
@Service
public class DefaultActivityChainFactory {

    private final IActionChain actionChain;
    public DefaultActivityChainFactory(Map<String,IActionChain> actionChainMap) {
        this.actionChain =  actionChainMap.get(ActionModel.activity_base_action.getCode());

        this.actionChain.appendNext(actionChainMap.get(ActionModel.activity_sku_stock_action.getCode()));
    }

    public IActionChain openActionChain() {
        return this.actionChain;
    }
    /**
     * 注解类只提供getter方法即可
     */
    @Getter
    @AllArgsConstructor
    public enum ActionModel{

      activity_base_action("activity_base_action","活动的库存、时间校验"),
      activity_sku_stock_action("activity_sku_stock_action","活动sku库存"),




        ;


    private final String code;
    private final String info;
    }

}
